{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.neural_network import MLPClassifier\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline\n",
    "import winsound"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "4521\n",
      "43\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>age</th>\n",
       "      <th>balance</th>\n",
       "      <th>day</th>\n",
       "      <th>duration</th>\n",
       "      <th>campaign</th>\n",
       "      <th>pdays</th>\n",
       "      <th>previous</th>\n",
       "      <th>job_blue-collar</th>\n",
       "      <th>job_entrepreneur</th>\n",
       "      <th>job_housemaid</th>\n",
       "      <th>...</th>\n",
       "      <th>month_jun</th>\n",
       "      <th>month_mar</th>\n",
       "      <th>month_may</th>\n",
       "      <th>month_nov</th>\n",
       "      <th>month_oct</th>\n",
       "      <th>month_sep</th>\n",
       "      <th>poutcome_other</th>\n",
       "      <th>poutcome_success</th>\n",
       "      <th>poutcome_unknown</th>\n",
       "      <th>y</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.161765</td>\n",
       "      <td>0.068455</td>\n",
       "      <td>0.600000</td>\n",
       "      <td>0.024826</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.205882</td>\n",
       "      <td>0.108750</td>\n",
       "      <td>0.333333</td>\n",
       "      <td>0.071500</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.389908</td>\n",
       "      <td>0.16</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.235294</td>\n",
       "      <td>0.062590</td>\n",
       "      <td>0.500000</td>\n",
       "      <td>0.059914</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.379587</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.161765</td>\n",
       "      <td>0.064281</td>\n",
       "      <td>0.066667</td>\n",
       "      <td>0.064548</td>\n",
       "      <td>0.061224</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.588235</td>\n",
       "      <td>0.044469</td>\n",
       "      <td>0.133333</td>\n",
       "      <td>0.073486</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.00</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 43 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        age   balance       day  duration  campaign     pdays  previous  \\\n",
       "0  0.161765  0.068455  0.600000  0.024826  0.000000  0.000000      0.00   \n",
       "1  0.205882  0.108750  0.333333  0.071500  0.000000  0.389908      0.16   \n",
       "2  0.235294  0.062590  0.500000  0.059914  0.000000  0.379587      0.04   \n",
       "3  0.161765  0.064281  0.066667  0.064548  0.061224  0.000000      0.00   \n",
       "4  0.588235  0.044469  0.133333  0.073486  0.000000  0.000000      0.00   \n",
       "\n",
       "   job_blue-collar  job_entrepreneur  job_housemaid ...  month_jun  month_mar  \\\n",
       "0                0                 0              0 ...          0          0   \n",
       "1                0                 0              0 ...          0          0   \n",
       "2                0                 0              0 ...          0          0   \n",
       "3                0                 0              0 ...          1          0   \n",
       "4                1                 0              0 ...          0          0   \n",
       "\n",
       "   month_may  month_nov  month_oct  month_sep  poutcome_other  \\\n",
       "0          0          0          1          0               0   \n",
       "1          1          0          0          0               0   \n",
       "2          0          0          0          0               0   \n",
       "3          0          0          0          0               0   \n",
       "4          1          0          0          0               0   \n",
       "\n",
       "   poutcome_success  poutcome_unknown  y  \n",
       "0                 0                 1  0  \n",
       "1                 0                 0  0  \n",
       "2                 0                 0  0  \n",
       "3                 0                 1  0  \n",
       "4                 0                 1  0  \n",
       "\n",
       "[5 rows x 43 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# df = pd.read_csv(\"../Data/bank.csv\", sep=\";\")\n",
    "df = pd.read_csv(\"../Data/Cleaned/bank_cleaned.csv\")\n",
    "print(len(df))\n",
    "print(len(df.columns))\n",
    "df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\Kieron\\Anaconda3\\lib\\site-packages\\sklearn\\neural_network\\multilayer_perceptron.py:563: ConvergenceWarning: Stochastic Optimizer: Maximum iterations reached and the optimization hasn't converged yet.\n",
      "  % (), ConvergenceWarning)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(1) ['alpha = 1e-06', 0.89478337754199821]\n",
      "(2) ['alpha = 1e-05', 0.8938992042440318]\n",
      "(3) ['alpha = 0.0001', 0.89832007073386388]\n",
      "(4) ['alpha = 0.001', 0.90274093722369586]\n",
      "(5) ['alpha = 0.01', 0.90274093722369586]\n",
      "(6) ['alpha = 0.1', 0.90804597701149425]\n",
      "(7) ['alpha = 1.0', 0.905393457117595]\n",
      "best score =  (6, 'alpha = 0.1', 0.90804597701149425)\n"
     ]
    },
    {
     "data": {
      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REQSTCEgIpJgCgERkQRTCIiIJJhC\nQEQkwRQCIiIJ9v8BE3E17pLQUmMAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x14af626fc88>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "#     alphas = np.logspace(-5, 0, 100)\n",
    "alphas = [1e-6, 1e-5, 1e-4, 1e-3, 1e-2, 1e-1, 1e-0]\n",
    "\n",
    "names = []\n",
    "for i in alphas:\n",
    "    names.append('alpha = ' + str(i))\n",
    "\n",
    "classifiers = []\n",
    "for i in alphas:\n",
    "    classifiers.append(MLPClassifier(alpha=i, random_state=1))\n",
    "\n",
    "X = df.drop('y',axis=1)\n",
    "y = df['y']\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y)#, test_size=.4)\n",
    "\n",
    "i = 0\n",
    "ilist = []\n",
    "best_score = None\n",
    "scores = []\n",
    "for name, clf in zip(names, classifiers):\n",
    "    clf.fit(X_train, y_train)\n",
    "    score = clf.score(X_test, y_test)\n",
    "    i+=1\n",
    "    if best_score is None:\n",
    "        best_score = i, name, score\n",
    "    if score > best_score[2]:\n",
    "        best_score = i, name, score\n",
    "\n",
    "\n",
    "    ilist.append(i)\n",
    "    print(\"(%s)\"%(i), [name, score])\n",
    "#         print(\"(%s)\"%(i), name, \"\\t\\t\\t score = \", score)\n",
    "\n",
    "    scores.append(score)\n",
    "\n",
    "    # alpha = 1e-05 | score =  0.90450928382\n",
    "    # alpha = 0.001 | score =  0.909814323607\n",
    "    # alpha = 0.1 | score =  0.909814323607\n",
    "    # alpha = 10.0 | score =  0.88240495137\n",
    "    # alpha = 1000.0 | score =  0.88240495137\n",
    "    \n",
    "#     (1) ['alpha = 1e-06', 0.89213085764809907]\n",
    "#     (2) ['alpha = 1e-05', 0.89213085764809907]\n",
    "#     (3) ['alpha = 0.0001', 0.89036251105216624]\n",
    "#     (4) ['alpha = 0.001', 0.89213085764809907]\n",
    "#     (5) ['alpha = 0.01', 0.89124668435013266]\n",
    "#     (6) ['alpha = 0.1', 0.90097259062776303]\n",
    "#     (7) ['alpha = 1.0', 0.89920424403183019]\n",
    "#     best score =  (6, 'alpha = 0.1', 0.90097259062776303)\n",
    "\n",
    "print(\"best score = \", best_score)\n",
    "\n",
    "plt.plot(ilist, scores)\n",
    "plt.show()\n",
    "\n",
    "winsound.Beep(300,300)\n",
    "winsound.Beep(400,300)\n",
    "winsound.Beep(300,300)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# alphas = np.logspace(-6, -1, 5)\n",
    "# print(scores)\n",
    "# print(alphas)\n",
    "# plt.plot(alphas, scores, \"x\")\n",
    "# plt.ylim(.88, .90)\n",
    "# plt.xlim(min(alphas), max(alphas))\n",
    "# plt.show()\n",
    "# print(min(alphas))\n",
    "# print(max(alphas))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
